package top.btcmarket.common.utils;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

import top.btcmarket.common.constant.CommonConst;

public class ToolUtils {

	public static String getCookieToken(HttpServletRequest request){
		String token = null ;
		if(request != null){
			 Cookie[] cookies = request.getCookies();
			 if(cookies != null && cookies.length>0){
				 for (Cookie cookie : cookies) {
					 if(CommonConst.TOKEN_COOKIE_ID.equals(cookie.getName())){
						 token = cookie.getValue() ;
						 break ;
					 }
				}
			 }
		}
		return token ;
	}
}
